// index.js
Page({
  data: {
    acticleList: [],
  },
  onLoad(){
    const loginData = wx.getStorageSync('loginData');
    const userInfo = wx.getStorageSync('userInfo') || {};
    let flag = JSON.stringify(userInfo) === '{}'
    if(flag) {
      wx.redirectTo({
        url: '/pages/authLogin/index',
      })
      return
    }
    this.getNextPage(loginData);
  },
  getNextPage(loginData){
    console.log('loginData',loginData);
    if(loginData.loginType === '1'){
      if(loginData.toBind === '0'){
        wx.redirectTo({
          url: '/pages/order-flow/index',
        })
      }else if(loginData.toBind === '1'){
        wx.redirectTo({
          url: '/pages/login/login',
        })
      }else if(loginData.toBind === '-1'){
        wx.redirectTo({
          url: '/pages/service-role/index',
        })
      }
    }else if(loginData.loginType === '2'){
      if(loginData.toBind === '0'){
        wx.redirectTo({
          url: '/pages/index/index',
        })
      }else if(loginData.toBind === '1'){
        wx.redirectTo({
          url: '/pages/manage-address/index',
        })
      }else if(loginData.toBind === '-1'){
        wx.redirectTo({
          url: '/pages/service-role/index',
        })
      }

    }else{
      wx.redirectTo({
        url: '/pages/service-role/index',
      })
      console.log('error')
    }
  },
})
